package 狂神.GUI;

import java.awt.*;

/**
 * @ClassName: TestGrid
 * @Auther: Drawin
 * @Date: 2021/12/23 14:19
 * @Description:
 */

public class TestGrid {//表格布局

    public static void main(String[] args) {
        Frame frame = new Frame("Grid");

        Button btn1 = new Button("btn1");
        Button btn2 = new Button("btn2");
        Button btn3 = new Button("btn3");
        Button btn4 = new Button("btn4");
        Button btn5 = new Button("btn5");
        Button btn6 = new Button("btn6");

        frame.setLayout(new GridLayout(3,2));
        frame.add(btn1);
        frame.add(btn2);
        frame.add(btn3);
        frame.add(btn4);
        frame.add(btn5);
        frame.add(btn6);

        frame.pack();//java函数,自适应
        frame.setSize(333,333);
        frame.setVisible(true);

    }
}
